/**
 * 
 */
package com.jzcodecheck.ui.core.component;

import java.awt.Component;
import java.text.DecimalFormat;

import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 * @author ASUS
 *  百分比渲染器
 */
public class PercentRender extends DefaultTableCellRenderer {
	
	private static DecimalFormat df = new DecimalFormat("0.00");
	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean isSelected, boolean hasFocus, int row, int column) 
	{ 
			super.getTableCellRendererComponent(table, value, isSelected, hasFocus,
			row, column);

			if (value instanceof Float){
				String s = df.format(value);
				setText(s+"%");
			}else{
				setText(value.toString());
			}
			return this;
	}
}
